import React, {Component} from "react";
import {CancellablePromise} from "mobx/lib/api/flow";

export class ComponentBaseExtend<T> extends Component<T> {
    cancel(b: CancellablePromise<any>): void {
        b.catch((e) => {
            this.setState(() => {
                throw new Error(e.message);
            });
        });
        b.cancel();
    }
}